from datetime import datetime
from app.common.model import BaseModel, RecodeMixinModel
from sqlalchemy import Column, DateTime, Integer, String, INT, func


class ClientModel(BaseModel):
    __tablename__ = 'client'

    id = Column(Integer, primary_key=True, autoincrement=True, comment='自增id')
    create_time = Column(DateTime, server_default=func.now(), comment='创建时间')
    openid = Column(String(32), nullable=False, comment='用户标识')
    phone = Column(String(32), comment='用户电话')
    nickname = Column(String(90), comment='用户名称')
    status = Column(INT, default=1, comment='用户状态')

    def __repr__(self):
        return f"<Client(id={self.id}, code={self.code}, nickname={self.nickname}, create_time={self.create_time})>"
